package com.yuan.task.scheduled;

import com.yuan.rabbit.constant.MQConst;
import com.yuan.rabbit.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
 * 计划任务
 * @Author yuan
 * @Date 2021/7/19 10:27
*/
@Component
@EnableScheduling
public class ScheduledTask {
    @Autowired
    private RabbitService rabbitService;

    /**
     * 每天8点执行方法，就医提醒
     * 0 0 8 * * ?
     */
    @Scheduled(cron = "0/59 * * * * ?")
    public void taskPatient(){
        rabbitService.sendMessage(MQConst.EXCHANGE_DIRECT_TASK, MQConst.ROUTING_TASK_8, "");
    }
}
